<?php

namespace ApplicationsModule\PreferencesModule;

use Nette\Debug;

use WebtopModule\BasePresenter;
use ApplicationsModule\PreferencesModule\DesktopPreferencesManagement;
use Nette\Forms\SubmitButton;
use Albireo\Forms\AlbireoForm;

final class PreferencesPresenter extends BasePresenter {

    public function startup() {
        parent::startup();
    }

    public function createComponentForm() {
        $form = new AlbireoForm($this,'form');
        $form->addSubmit('desktopPreferences', 'Desktop Preferences')->onClick[] = array($this,'launchDesktopPreferences');

        return $form;
    }

    public function launchDesktopPreferences() {
        $this->redirect('desktopPreferences:default');
    }

    public function renderDefault() {
        $this->template->form = $this['form'];
        echo "TEST DESKTOP MANAGEMENTU:";
        $db = new \WebtopModule\DesktopModule\DesktopManagement(0);
        $db->loadDesktop();
        echo "DESKTOP:";
        \Nette\Debug::dump($db->getDesktop());
    }
}
